<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "xd_news_category".
 *
 * @property string $id
 * @property string $name
 * @property string $desc
 * @property integer $status
 * @property string $create_time
 * @property string $update_time
 */
class NewsCategory extends \yii\db\ActiveRecord
{
    const STATUS_INACTIVE = 0;
    const STATUS_ACTIVE   = 1;
    const STATUS_DELETED  = 2;
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'xd_news_category';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['status'], 'integer'],
            [['create_time', 'update_time'], 'safe'],
            [['name'], 'string', 'max' => 100],
            [['desc'], 'string', 'max' => 500],
            [['name'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', '分类id'),
            'name' => Yii::t('app', '分类名称'),
            'desc' => Yii::t('app', '分类描述'),
            'status' => Yii::t('app', '分类状态'),
            'create_time' => Yii::t('app', '创建时间'),
            'update_time' => Yii::t('app', '修改时间'),
        ];
    }
}
